package com.demo.common.api;

/**
 * @author tomZyh
 * @description
 * @createTime 2021/4/15
 */
public enum ResultConstant {


    NOT_BIND_MOBILE(10000,"未绑定手机号"),
    MSG_TOO_OFTEN(10001,"访问频繁，请稍后再试"),
    LOGIN_CHECK_CODE_ERROR(10003,"验证码错误"),
    MSG_PAST(10002,"验证码已过期"),
    PLATFORM_EMPTY(10004,"用户手机平台不能为空"),
    USER_DELETED(20004,"用户已注销"),
    USER_FROZEN(20005,"用户账号被冻结"),
    USER_IS_NOT_EXIST(20006,"用户不存在"),
    SYSTEM_BUSY(20001,"操作失败"),
    ID_NOT_EXIST(20007,"id不存在"),
    NOT_ALL_SUCCESS(20008,"未完全删除成功"),
    OPT_FAIL(20009,"操作失败"),
    USER_ID_IS_NULL(20010,"用户id不能为空"),
    ADDRESS_ID_IS_NULL(20011,"地址id不能为空"),
    USER_NOT_CONFIRM(20012,"用户未认证"),
    USER_IDENTITY_ERROR(20013,"用户身份错误"),




    TOKEN_EMPTY(5000,"token 为空"),
    PAST_TOKEN(5001,"token过期"),
    ERROR_TOKEN(5002,"token不合法"),
    ADDRESS_TYPE(2005,"地址类型参数错误"),
    FILE_UPLOAD_FAILE(2004,"文件上传失败"),
    DEVICE_ID_MISSING(2003,"deviceId 参数缺失"),
    FILE_TOO_BIG(2002,"文件过大"),
    FILE_TYPE_ERROR(2001,"文件格式错误"),
    PARAMS_ERRORS(2000,"参数错误"),


    /**
     * 服务
     */
    FEIGN_ERROR_PRODUCT(40001,"远程调用服务中心出错"),
    FEIGN_ERROR_UAA(40002,"远程调用用户中心出错"),
    FEIGN_ERROR_ORDER(40003,"远程调用订单中心出错"),
    ON_SHELF_ERROR(40004,"服务上架失败"),
    OFF_SHELF_ERROR(40005,"服务下架失败"),


    /**
     * 订单
     */
    ORDER_UN_CONFIRMED(30011,"用户未确认"),
    ORDER_CONFIRMED(30010,"用户已确认"),
    ORDER_NO_AUTH(30009,"没有操作权限"),
    QR_PAST(30008,"二维码过期"),
    ORDER_CANCEL_WAIT_CONFIRM(30007,"待工程师确认"),
    ORDER_CANCEL(30006,"订单已被取消"),
    BOOK_TIME_PAST(30005,"预约时间有误"),
    ORDER_OWNER_GRAB(30004,"您不能接自己派发的任务"),
    ORDER_NOT_EXIST(30003,"订单不存在"),
    ORDER_TOKEN(30002,"订单被抢走了"),
    SUCCESS_RESERVE(200,"预约任务已发出"),
    GRAB_ORDER(200,"接单成功"),
    GENERATED_ORDER(30001,"已经预约过相同的服务，请勿重复预约");

    private int code;
    private String msg;
    ResultConstant(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Result<?> error() {
        return Result.error(this.code,this.msg);
    }
    public Result<?> OK() {
        Result<?> ok = Result.OK();
        ok.setMessage(this.msg);
        return ok;
    }

}
